﻿using Microsoft.SharePoint;
using System.IO;

namespace SP.Exporters
{
    /// <summary>
    /// A generic class that exports a SharePoint entity to a stream.
    /// </summary>
    public abstract class SPExporter
    {
        /// <summary>
        /// Gets or sets the SP entity.
        /// </summary>
        /// <value>
        /// The SP entity.
        /// </value>
        public SPSecurableObject SPEntity { get; set; }
        /// <summary>
        /// Gets or sets the template file.
        /// </summary>
        /// <value>
        /// The template file.
        /// </value>
        public SPFile TemplateFile { get; set; }
        protected SPExporter(SPSecurableObject spEntity, SPFile templateFile)
        {
            SPEntity = spEntity;
            TemplateFile = templateFile;
        }

        /// <summary>
        /// Exports the SP Entity to a stream.
        /// </summary>
        /// <returns></returns>
        public abstract Stream Export();

    }
}
